#pragma once

class CSimpleImageButton;
class ISimpleImageButtonEventListener;

class ISimpleImageButtonEventListener
{
public:
	virtual void OnClick(CSimpleImageButton* pEventSource) = 0;
	virtual void OnDClick(CSimpleImageButton* pEventSource) = 0;
};

// CSimpleImageButton

class CSimpleImageButton : public CButton
{
	DECLARE_DYNAMIC(CSimpleImageButton)

public:
	CSimpleImageButton();
	virtual ~CSimpleImageButton();

public:
	void CreateButton(UINT nID , LPCTSTR lpszCaption, std::wstring normal, std::wstring horver, std::wstring press, std::wstring disEnable, CWnd* pParentWnd);

protected:
	DECLARE_MESSAGE_MAP()
protected:
	typedef enum enmButtonState
	{
		enmButtonState_Normal   = 0,
		enmButtonState_Hover    = 1,
		enmButtonState_Down     = 2,
		enmButtonState_Disabled = 3,

		enmButtonState_Checked  = 4,
	} ButtonMouseState;
protected:
	DWORD m_buttonStyle;
	Gdiplus::Bitmap* m_pNormalImage;
	Gdiplus::Bitmap* m_pHorverImage;
	Gdiplus::Bitmap* m_pPressImage;
	ButtonMouseState m_eState;
	ISimpleImageButtonEventListener* m_eventListener;
public:
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
	afx_msg void OnMouseLeave();
	afx_msg void OnMouseHover(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	//void draw(Gdiplus::Graphics* pGraphics);
public:
	void setButtonEventListener(ISimpleImageButtonEventListener* listener);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
protected:
	void ChangeState(ButtonMouseState eState);
};


